<extend name="Base/lrbase" />

<block name="style">
	<link href="__CSS__/card_control.css" rel="stylesheet">
	<link href="__CSS__/section_card_notification.css" rel="stylesheet">
	<link href="__CSS__/datepicker3.css" rel="stylesheet">
	<link href="__STATICLR__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <link href="__STATICLR__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATICLR__/uploadify/jquery.uploadify.min.js"></script>
</block>

<block name="body">
	<div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-lg-10">
            <h2>编辑兑换信息</h2>
            <ol class="breadcrumb">
                <li><a href="{:U('Jifenduihuan/lists')}">Jifenduihuan</a></li>
                <li class="active"><strong>编辑兑换信息</strong></li>
            </ol>
        </div>
    	<div class="col-lg-2"></div>
    </div>

    <div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-lg-6">
				<div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>详情</h5>
                    </div>
                    <div class="ibox-content">
                    	<form class="form-horizontal" id="pwdform" action="{:U('edit')}" method="POST">
                    		<input name="id" type="hidden" value="{$data.id}" />
                    		<div class="form-group"><label class="col-lg-2 control-label">商品名称</label>
                                    <div class="col-lg-10">
                                    	<input type="text" class="form-control" placeholder="商品名称" name="goodsname"  value="{$data.goodsname}">
                                    	<span class="help-block m-b-none"></span>
                                    </div>
                                </div>

                    		<div class="form-group"><label class="col-lg-2 control-label">需要积分</label>
                                    <div class="col-lg-10">
                                    	<input type="text" class="form-control" placeholder="需要积分" name="price" value="{$data.price}">
                                    	<span class="help-block m-b-none"></span>
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-lg-2 control-label">开始时间</label>
                                    <div class="col-lg-10">
                                    	<div class="controls">
							                <input type="text" name="starttime" class="text input-mid date" value="{$data.starttime}" placeholder="请选择日期">
							            </div>
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-lg-2 control-label">结束时间</label>
                                    <div class="col-lg-10">
                                    	<div class="controls">
							                <input type="text" name="endtime" class="text input-mid date" value="{$data.endtime}" placeholder="请选择日期">
							            </div>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-lg-2 control-label">促销图片</label>
                                    <div class="col-lg-10">
                                    	<div class="controls">
						                    <input type="file" id="upload_picture_cardimage">
						                    <input type="hidden" name="promotionimage" id="cover_id_cardimage" value="{$data.promotionimage}"/>
						                    <div class="upload-img-box">
                                                <img src="{$data.promotionimage|get_cover='path'}"/>
						                    </div>
						                </div>
						                <script type="text/javascript">
						                    //上传图片
						                    /* 初始化上传插件 */
						                    $("#upload_picture_cardimage").uploadify({
						                        "height"          : 30,
						                            "swf"             : "__STATICLR__/uploadify/uploadify.swf",
						                            "fileObjName"     : "download",
						                            "buttonText"      : "上传图片",
						                            "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
						                            "width"           : 120,
						                            'removeTimeout'   : 1,
						                            'fileTypeExts'    : '*.jpg; *.png; *.gif;',
						                            "onUploadSuccess" : uploadPicturecardimage,
						                            'onFallback' : function() {
						                                alert('未检测到兼容版本的Flash.');
						                            }
						                        });
						                    function uploadPicturecardimage(file, data){
						                        var data = $.parseJSON(data);
						                        var src = '';
						                        if(data.status){
						                            $("#cover_id_cardimage").val(data.id);
						                            src = data.url || '__ROOT__' + data.path;
						                            $("#cover_id_cardimage").parent().find('.upload-img-box').html(
						                               '<div class="upload-pre-item"><img src="' + src + '"/></div>'
						                            );
						                        } else {
						                            updateAlert(data.info);
						                            setTimeout(function(){
						                                $('#top-alert').find('button').click();
						                                $(that).removeClass('disabled').prop('disabled',false);
						                            },1500);
						                        }
						                    }
						                </script>
                                    </div>
                                </div>

                    		<div class="form-group">
                    			<div class="col-lg-offset-1 col-lg-2">
                    				<button type="submit" class="btn btn-sm btn-primary"> 修改 </button>
                                </div>
                                <div class=" col-lg-2">
                                    <button type="submit" class="btn btn-sm btn-primary" onclick="javascript:history.back(-1);"> 返回 </button>
                                </div>
                            </div>
                        </form>
                    </div>
				</div>
            </div>
		</div>
    </div>
</block>

<block name="script">
	
	<script type="text/javascript" src="__STATICLR__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATICLR__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        $(function(){
            $('#submit').click(function(){
                $('#form').submit();
            });
            $('.time').datetimepicker({
                format: 'yyyy-mm-dd hh:ii',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });
            $('.date').datetimepicker({
                format: 'yyyy-mm-dd',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });
        });
    </script>
</block>